﻿<%@ Page Title="" Language="C#" MasterPageFile="~/master_form.master" AutoEventWireup="true" CodeFile="chon_ns.aspx.cs" Inherits="App_Form_DanhMuc_chom_phongban" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <div id="conten">
        <script type="text/javascript">
            function P_DATA(b_kq) {
                Ext.require([
                'Ext.selection.CellModel',
                'Ext.grid.*',
                'Ext.data.*',
                'Ext.util.*',
                'Ext.state.*',
                'Ext.form.*',
                'Ext.grid.Panel'
                ]);
                var a_data = Ext.create('Ext.data.Store', {
                    fields: ['id_pc', 'id_ns', 'hoten', 'ngay_sinh', 'noi_sinh'],
                    data: b_kq
                });

                Ext.onReady(function () {

                    Ext.QuickTips.init();

                    var bd = Ext.getBody();

                    var gridForm = Ext.create('Ext.form.Panel',
                    {
                        id: 'form_phong',
                        frame: true,
                        layout:
                        {
                            type: 'table',
                            columns: 1
                        },
                        fieldDefaults:
                        {
                            labelAlign: 'left',
                            msgTarget: 'side'
                        },

                        items:
                        [
                            {
                                xtype: 'gridpanel',
                                margin: '0 0 0 1',
                                store: null,
                                id: 'phongban',
                                width: 400,
                                height: 290,
                                columns: [
                                    { id: 'MA1', flex: 1, text: 'Mã', width: 90, sortable: true, hidden: true, dataIndex: 'id_ns' },
                                    { id: 'TEN1', text: 'Tên', width: 300, flex: 1, sortable: true, dataIndex: 'hoten' }
                                ],
                                store: a_data,
                                listeners: {
                                    selectionchange: function (model, records) {
                                        if (records[0]) {
                                            var b_ma = records[0].get("id_ns") + "#" + records[0].get("hoten");
                                            $("#ndung").text(b_ma);
                                        }
                                    }
                                }
                            }
                        ],
                        renderTo: bd
                    });
                });
            }
        </script>
    </div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div id="ndung" style="display: none;"></div>
</asp:Content>

